#include <stdio.h>

struct msg {
	char name[4];
	int ibreathe;
	int ipulse;
};

int main() {
	int sum;
	scanf("%d",&sum);
	
	struct msg allmsg[sum];
	int i;
	for(i=0;i<sum;i++) {
		scanf("%s %d %d",&allmsg[i].name,&allmsg[i].ibreathe,&allmsg[i].ipulse);
	}
	
	for(i=0;i<sum;i++) {
		if ((allmsg[i].ibreathe < 15) || (allmsg[i].ibreathe > 20) || (allmsg[i].ipulse < 50) || (allmsg[i].ipulse > 70 )) {
			printf("%s\n",allmsg[i].name);
		}
	}
	return 0;
}